﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Threading;

namespace WindowsFormsApplication3
{
    public partial class Form1 : Form
    {
        [DllImport("user32.dll")]
        static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, uint dwExtraInfo);


        public Form1()
        {
            InitializeComponent();
        }

        private void buttonstart_Click(object sender, EventArgs e)
        {
            //Thread h = new Thread(start);
            //keybd_event(18, 0, 0, 0); //按下CTRL鍵 
           for (int i = 0; i < 200; ++i)
            {
                //byte zimu = Convert.('f');
                keybd_event(32, 0, 0, 0);//鍵下f鍵。 
                Thread.Sleep(50);//等待1秒 　　 ?            keybd_event(zimu , 0, 0x2, 0);//放開f鍵。　　0x35　  　　 
                keybd_event(32, 0, 2, 0);
            }
        }

        private void start()
        {
            
        }
    }
}
